<template>
  <div class="selfAssessment">
    <div class="assessment">
      <van-collapse v-model="activeNames">
        <div v-for="(value,index) in abilityClassification" :key="index">
          <van-collapse-item :title="value.name" v-if="value.selfAssessment">
            <div class="group" v-for="(item,index) in value.child" :key="index">
              <van-cell :title="item.name" />
              <van-rate v-model="item.score" color="#ffd21e" :size="15" />
            </div>
          </van-collapse-item>
        </div>
      </van-collapse>
    </div>
    <van-button color="#7232dd" plain @click="subit" style="display:block;margin:20px auto">提交</van-button>
    <van-cell @click="show = true">
      <van-button icon="plus" type="primary" color="#C0CBD9" block />
    </van-cell>
    <van-action-sheet
      v-model="show"
      :actions="abilityClassification"
      cancel-text="取消"
      description="评分分类"
      close-on-click-action
      @cancel="onCancel"
      @select="onSelect"
    />
  </div>
</template>

<script>
import { Toast } from "vant";
import { ReqAdviserScored } from "../../../request/index";
export default {
  data() {
    return {
      count: 1,
      arrs: [{ value: 1, customItem: "" }],
      activeNames: ["1"],
      show: false,
      abilityClassification: [
        {
          name: "通用软技能",
          textName: "通用软技能",
          selfAssessment: false,
          disabled: false,
          child: [
            {
              name: "沟通能力",
              score: 0
            },
            {
              name: "写作能力",
              score: 0
            },
            {
              name: "语言表达能力",
              score: 0
            },
            {
              name: "演讲能力",
              score: 0
            },
            {
              name: "学习能力",
              score: 0
            },
            {
              name: "创新能力",
              score: 0
            },
            {
              name: "时间管理",
              score: 0
            },
            {
              name: "谈判能力",
              score: 0
            },
            {
              name: "心理学",
              score: 0
            },
            {
              name: "谈判能力",
              score: 0
            },
            {
              name: "哲学",
              score: 0
            },
            {
              name: "领导力",
              score: 0
            },
            {
              name: "组织协调能力",
              score: 0
            },
            {
              name: "团队建设",
              score: 0
            },
            {
              name: "团队协作",
              score: 0
            },
            {
              name: "商务公文写作",
              score: 0
            },
            {
              name: "控场能力",
              score: 0
            },
            {
              name: "应收款催款技巧",
              score: 0
            },
            {
              name: "报价能力",
              score: 0
            },
            {
              name: "报价能力",
              score: 0
            },
            {
              name: "销售商机获取能力",
              score: 0
            },
            {
              name: "甄别和发展内线能力",
              score: 0
            },
            {
              name: "逼单和催单能力",
              score: 0
            }
          ]
        },
        {
          name: "通用专业能力",
          textName: "通用专业能力",
          selfAssessment: false,
          disabled: false,
          child: [
            {
              name: "通用干系人管理能力",
              score: 0
            },
            {
              name: "通用项目资源管理能力",
              score: 0
            },
            {
              name: "通用项目计划管理能力",
              score: 0
            },
            {
              name: "客户IT应用现状调研能力",
              score: 0
            },
            {
              name: "信息化需求分析能力",
              score: 0
            },
            {
              name: "信息化规划咨询能力",
              score: 0
            },
            {
              name: "客户IT系统应用效果评价能力",
              score: 0
            },
            {
              name: "制作IT项目商业论证能力",
              score: 0
            },
            {
              name: "IT系统选型标准定义能力",
              score: 0
            },
            {
              name: "问题解决能力",
              score: 0
            },
            {
              name: "业务知识能力",
              score: 0
            },
            {
              name: "客户和团队互动能力",
              score: 0
            },
            {
              name: "策划项目立项的能力",
              score: 0
            },
            {
              name: "信息化系统范围能力",
              score: 0
            },
            {
              name: "风险识别和控制能力",
              score: 0
            },
            {
              name: "危机和问题处理能力",
              score: 0
            },
            {
              name: "范围识别能力",
              score: 0
            },
            {
              name: "SOW解读能力",
              score: 0
            },
            {
              name: "成本分析能力",
              score: 0
            },
            {
              name: "企业信息化常用系统的功能和适用业务",
              score: 0
            },
            {
              name: "项目进度汇报能力",
              score: 0
            },
            {
              name: "商机是否成立的评估能力",
              score: 0
            }
          ]
        },
        {
          name: "SAP MM顾问",
          textName: "SAP MM顾问",
          selfAssessment: false,
          disabled: false,
          child: [
            {
              name: "MM-主数据-物料",
              score: 0
            },
            {
              name: "MM-主数据-批次管理",
              score: 0
            },
            {
              name: "MM-采购主数据-供应商管理",
              score: 0
            },
            {
              name: "MM-采购主数据-信息记录管理",
              score: 0
            },
            {
              name: "MM-采购主数据-货源清单",
              score: 0
            },
            {
              name: "MM-采购主数据-配额协议",
              score: 0
            },
            {
              name: "MM-采购主数据-供应商评估",
              score: 0
            },
            {
              name: "MM-采购管理-采购申请管理",
              score: 0
            },
            {
              name: "MM-采购管理-询报价",
              score: 0
            },
            {
              name: "MM-采购管理-采购订单管理",
              score: 0
            },
            {
              name: "MM-采购管理-收货功能",
              score: 0
            },
            {
              name: "MM-库存管理-框架协议管理",
              score: 0
            },
            {
              name: "MM-库存管理-发货功能",
              score: 0
            },
            {
              name: "MM-库存管理-转储功能",
              score: 0
            },
            {
              name: "MM-库存管理-特殊库存管理",
              score: 0
            },
            {
              name: "MM-库存管理-预留",
              score: 0
            },
            {
              name: "MM-库存管理-盘点",
              score: 0
            }
          ]
        },
        {
          name: "SAP SD顾问",
          textName: "SAP SD顾问",
          selfAssessment: false,
          disabled: false,
          child: [
            {
              name: "SD-主数据-客户主数据",
              score: 0
            },
            {
              name: "SD-主数据-价格主数据",
              score: 0
            },
            {
              name: "SD-主数据-客户物料主数据",
              score: 0
            },
            {
              name: "SD-主数据-信贷主数据",
              score: 0
            },
            {
              name: "SD-销售管理-销售合同",
              score: 0
            },
            {
              name: "SD-销售管理-销售订单",
              score: 0
            },
            {
              name: "SD-销售管理-信用管控",
              score: 0
            },
            {
              name: "SD-销售管理-产品物料销售控制",
              score: 0
            },
            {
              name: "SD-销售管理-销售定价",
              score: 0
            },
            {
              name: "SD-销售管理-交货",
              score: 0
            },
            {
              name: "SD-跨模块功能-开票",
              score: 0
            },
            {
              name: "SD-跨模块功能-包装",
              score: 0
            },
            {
              name: "SD-跨模块功能-运输管理",
              score: 0
            }
          ]
        },
        {
          name: "SAP PP顾问",
          textName: "SAP PP顾问",
          selfAssessment: false,
          disabled: false,
          child: [
            {
              name: "PP-生产基本数据管理-物料主数据管理",
              score: 0
            },
            {
              name: "PP-生产基本数据管理-物料清单管理",
              score: 0
            },
            {
              name: "PP-生产基本数据管理-工作中心管理",
              score: 0
            },
            {
              name: "PP-生产基本数据管理-工艺路线管理",
              score: 0
            },
            {
              name: "PP-生产基本数据管理-生产版本管理",
              score: 0
            },
            {
              name: "PP-生产计划管理-SOP",
              score: 0
            },
            {
              name: "PP-生产计划管理-需求管理",
              score: 0
            },
            {
              name: "PP-生产计划管理-长期计划编制和模拟",
              score: 0
            },
            {
              name: "PP-生产计划管理-计划编制",
              score: 0
            },
            {
              name: "PP-生产计划管理-MRP",
              score: 0
            },
            {
              name: "PP-生产执行控制-SFC车间订单管理",
              score: 0
            },
            {
              name: "PP-生产执行控制-CRP能力计划",
              score: 0
            },
            {
              name: "PP-生产执行控制-生产执行",
              score: 0
            },
            {
              name: "PP-生产成本核算-生产订单管理",
              score: 0
            },
            {
              name: "PP-生产成本核算-生产期间成本管理",
              score: 0
            },
            {
              name: "PP-生产信息系统-生产信息报表",
              score: 0
            }
          ]
        },
        {
          name: "SAP SD顾问",
          textName: "SAP SD顾问",
          selfAssessment: false,
          disabled: false,
          child: [
            {
              name: "FICO-总账会计-组织架构",
              score: 0
            },
            {
              name: "FICO-总账会计-会计科目表",
              score: 0
            },
            {
              name: "FICO-总账会计-总账会计凭证处理",
              score: 0
            },
            {
              name: "FICO-总账会计-简化操作处理",
              score: 0
            },
            {
              name: "FICO-总账会计-会计凭证批量录入",
              score: 0
            },
            {
              name: "FICO-总账会计-总账期末处理",
              score: 0
            },
            {
              name: "FICO-总账会计-总账财务报表",
              score: 0
            },
            {
              name: "FICO-应收账款-客户主数据维护",
              score: 0
            },
            {
              name: "FICO-应收账款-销售发货及开票",
              score: 0
            },
            {
              name: "FICO-应收账款-收款及清账",
              score: 0
            },
            {
              name: "FICO-应收账款-收款条件及账龄分析",
              score: 0
            },
            {
              name: "FICO-应收账款-应收账款汇兑损益",
              score: 0
            },
            {
              name: "FICO-应收账款-应收报表",
              score: 0
            },
            {
              name: "FICO-应付账款-供应商主数据",
              score: 0
            },
            {
              name: "FICO-应付账款-采购订单收货确认暂估",
              score: 0
            },
            {
              name: "FICO-应付账款-采购发票校验",
              score: 0
            },
            {
              name: "FICO-应付账款-付款及清账",
              score: 0
            },
            {
              name: "FICO-应付账款-付款条件及账龄分析",
              score: 0
            },
            {
              name: "FICO-应付账款-应付账款汇兑损益",
              score: 0
            },
            {
              name: "FICO-应付账款-应付报表",
              score: 0
            },
            {
              name: "FICO-资产-资产主数据",
              score: 0
            },
            {
              name: "FICO-资产-资产折旧",
              score: 0
            },
            {
              name: "FICO-资产-资产全生命周期管理",
              score: 0
            },
            {
              name: "FICO-资产-资产报表",
              score: 0
            },
            {
              name: "FICO-成本要素会计-控制范围",
              score: 0
            },
            {
              name: "FICO-成本要素会计-初级成本要素",
              score: 0
            },
            {
              name: "FICO-成本要素会计-次级成本要素",
              score: 0
            },
            {
              name: "FICO-成本中心会计-主数据",
              score: 0
            },
            {
              name: "FICO-成本中心会计-成本中心业务",
              score: 0
            },
            {
              name: "FICO-内部订单会计-主数据",
              score: 0
            },
            {
              name: "FICO-内部订单会计-内部订单业务",
              score: 0
            },
            {
              name: "FICO-产品成本控制-产品成本相关主数据",
              score: 0
            },
            {
              name: "FICO-产品成本控制-产品成本计划",
              score: 0
            },
            {
              name: "FICO-产品成本控制-成本对象控制",
              score: 0
            },
            {
              name: "FICO-产品成本控制-实际成本核算",
              score: 0
            },
            {
              name: "FICO-获利能力分析-获利能力分析主数据",
              score: 0
            },
            {
              name: "FICO-获利能力分析-经营范围",
              score: 0
            },
            {
              name: "FICO-获利能力分析-获利能力分析报表",
              score: 0
            },
            {
              name: "FICO-利润中心会计-利润中心主数据",
              score: 0
            },
            {
              name: "FICO-利润中心会计-利润中心报表",
              score: 0
            }
          ]
        },
        {
          name: "SAP QM顾问",
          textName: "SAP QM顾问",
          selfAssessment: false,
          disabled: false,
          child: [
            {
              name: "QM-质检主数据-物料主数据",
              score: 0
            },
            {
              name: "QM-质检主数据-校验目录",
              score: 0
            },
            {
              name: "QM-质检主数据-检验特性",
              score: 0
            },
            {
              name: "QM-质检主数据-抽样方案",
              score: 0
            },
            {
              name: "QM-质检主数据-抽样程序",
              score: 0
            },
            {
              name: "QM-检验计划-检验计划",
              score: 0
            },
            {
              name: "QM-检验计划-检验工作中心",
              score: 0
            },
            {
              name: "QM-检验计划-检验方法",
              score: 0
            },
            {
              name: "QM-质量成本管理-质量成本",
              score: 0
            },
            {
              name: "QM-质量通知管理-质量通知",
              score: 0
            }
          ]
        }
      ]
    };
  },
  methods: {
    newadd() {
      this.count++;
      this.arrs.push({ customItem: "", value: this.count });
    },
    onCancel() {
      Toast("取消");
    },
    onSelect(item) {
      this.show = false;
      item.selfAssessment = true;
      item.disabled = true
      // console.log(item)
    },
    async subit() {
      for(var i = 0;i<this.abilityClassification.length;i++){
        delete this.abilityClassification[i].selfAssessment
        delete this.abilityClassification[i].name
        delete this.abilityClassification[i].disabled
      }
      const data = {
        createdId: sessionStorage.getItem("id"), //合作伙伴的id
        scoreDetails: JSON.stringify({ score: this.abilityClassification }),
        scoredId: sessionStorage.getItem('id')
      };
      // console.log(data);
      const resultInfo = await ReqAdviserScored(data);
      const { code } = resultInfo;
      if (code === 0) {
        this.$message({
          type: "success",
          message: "评分成功"
        });
      }
      this.$router.push('/self/adviser/advIndex')
    }
  },
  watch: {
    actions: {
      handler(val) {
        // console.log(val);
      },
      deep: true
    }
  }
};
</script>

<style>
.selfAssessment .assessment .group {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.van-collapse-item {
  background: #c0cbd9;
}
</style>